const express = require('express');

const cors = require('cors');

var app = express();

//跨域
app.all("*", (req, res, next) => {
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Metheds", "PUT, POST, GET, DELETE, OPTIONS");
    next();
});

process.on('uncaughtException', function (err) {
    console.error(err);
    console.log("Node NOT Exiting...");
});

app.use(cors());

app.get('/index', function (req, res) {
    res.sendFile(__dirname + "/index.html");
})


module.exports = app